<template>
  <svg :style="{ width: width, height: height }">
    <use :xlink:href="prefix + iconName" :fill="color"></use>
  </svg>
</template>

<script setup lang="ts">
// 接收父组件传过来的参数
defineProps({
  // xlink:href 属性值前缀
  prefix: {
    type: String,
    default: '#icon-'
  },
  // 图标名称
  iconName: {
    type: String,
    default: ''
  },
  // color
  color: {
    type: String,
    default: ''
  },
  width: {
    type: String,
    default: '30px'
  },
  height: {
    type: String,
    default: '30px'
  }
})
</script>

<style scoped></style>